# import matplotlib.pyplot as plt
# import pandas as pd
# from cycler import cycler
# import numpy as np
# df = pd.read_excel('城镇单位就业人员年平均工资.xlsx',sheet_name='按行业',index_col=0)
# df.drop('城镇单位',inplace=True)
# df.drop(columns=['2001年','2002年'],inplace=True)
# df.sort_index(axis=1,inplace=True)
# plt.rcParams['figure.figsize']=(12,8)
# plt.rcParams['font.sans-serif']='SimHei'
# colors=[]
# for i in range(len(df)):
#     r = np.random.rand()
#     g = np.random.rand()
#     b = np.random.rand()
#     colors.append((r,g,b))
# plt.rcParams['axes.prop_cycle']=cycler(color=colors)
# plt.title('2003-2020年按行业分城镇单位就业人员年平均工资折线图')
# plt.xlabel('年份')
# plt.ylabel('平均工资/元')
# x=df.columns
# for index in df.index:
#     plt.plot(df.loc[index])
# plt.legend(df.index)
# plt.show()
# import matplotlib.pyplot as plt
# import pandas as pd
# df = pd.read_excel('餐饮综合数据.xlsx',sheet_name='订单详情表',index_col=0)
# plt.rcParams['font.sans-serif']='SimHei'
# x=df['价格']
# plt.xlabel('菜品价格/元')
# plt.ylabel('菜品数量')
# plt.title('不同价格区间菜品数量分布直方图')
# plt.hist(x,bins=12,color=(0.894,0,0.498),edgecolor='k')
# plt.show()
# import matplotlib.pyplot as plt
# import pandas as pd
# df = pd.read_excel('~$cjd.xlsx')
# plt.rcParams['font.sans-serif']='SimHei'
# x=df['数学']
# plt.xlabel('数学成绩')
# plt.ylabel('人数')
# plt.title('数学成绩分布直方图')
# plt.hist(x,bins=12,color=(0.894,0,0.498),edgecolor='k')
# plt.show()
import matplotlib.pyplot as plt
import pandas as pd

data = {
    '学科': ['语文', '数学', '英语', '物理', '化学'],
    '成绩': [92, 88, 95, 78, 85]
}
df = pd.DataFrame(data)
plt.rcParams['font.sans-serif'] = 'SimHei'
plt.figure(figsize=(8, 5))
plt.bar(
    x=df['学科'],
    height=df['成绩'],
    color='skyblue',
    edgecolor='black'
)
plt.xlabel('学科', fontsize=12)
plt.ylabel('成绩（分）', fontsize=12)
plt.title('学生各学科成绩对比', fontsize=14, pad=15)
plt.grid(axis='y', alpha=0.3, linestyle='--')
plt.show()
